<?php



$id = empty($_GET['id']) ? 0 : intval($_GET['id']);
$oLibrary = new Library();
$library_tree = $oLibrary->get_library_tree_ul();	// 取分类树

$oSentence = new Sentence();
$sentence_info = $oSentence->get_row($id, '*');
if(!empty($sentence_info)){
	$list = array();
	$call = $oSentence->get_all('`id`,`langid`,`content`', array('libraryid' => $sentence_info['libraryid'], 'mark' => $sentence_info['mark']), array());
	$carr = array();
	foreach($call['list'] as $key => $row){
		$carr[$row['langid']] = $row;
	}
	foreach($__f_langs['lang_id_name_list'] as $langid => $langname){
		if(array_key_exists($langid, $carr)){
			$list[] = array(
				'langname'	=> $langname,
				'langid'	=> $langid,
				'libraryid'	=> $sentence_info['libraryid'],
				'mark'		=> $sentence_info['mark'],
				'content'	=> $carr[$langid]['content'],
				'id'		=> $carr[$langid]['id'],
			);
		}else{
			$list[] = array(
				'langname'	=> $langname,
				'langid'	=> $langid,
				'libraryid'	=> $sentence_info['libraryid'],
				'mark'		=> $sentence_info['mark'],
				'content'	=> '',
				'id'		=> 0,
			);
		}
	}
	
	$sentence_info['state'] = $sentence_info['state'] == 1 ? true : false;
	$sentence_info['library_name'] = $_f_librarys['library_list'][$sentence_info['libraryid']]['name'];
	$sentence_info['lang_options'] = make_options($__f_langs['lang_id_name_list'], false, $sentence_info['langid']);
	$sentence_info['library_tree'] = $library_tree;
	
	$sentence_info['list'] = $list;
	$vars['info'] = $sentence_info;
	
}


?>